<%@ page language="java" import="java.util.*,shop.dao.*,shop.entity.*"  pageEncoding="utf-8"%>
<%@ page import="myservlet.OnlineCounter" %> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!-- 数据库连接 -->
<%
	ProductDao pt = new ProductDao();
	List P2 = pt.findProductBYBest();
	List Pl = pt.findProduct();
	TypeDao pt1 = new TypeDao();
   //导航栏 
	List pl2 = pt1.findmain_type();
	%>
	<!-- 数据库连接 -->
  <head>
  <meta charset="UTF-8">

  <meta name="description" content="">
  <meta name="keywords" content="">

  <title>登录</title>

    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
  <link href="css/style.css" media="screen" rel="stylesheet" type="text/css">
  <link href="css/grid.css" media="screen" rel="stylesheet" type="text/css">
 
  <script src="js/jquery-1.7.2.min.js" ></script>
  <script src="js/html5.js" ></script>
  <script src="js/jflow.plus.js"></script>
  <script src="js/jquery.carouFredSel-5.2.2-packed.js"></script>
  <script src="js/checkbox.js"></script>
  <script src="js/radio.js"></script>
  <script src="js/selectBox.js"></script>

   	<script type="text/javascript">
		function fun_check_form(){
			if(document.getElementById('userName').value==""){
				alert("请输入账号。");
				return false;
			}else if(document.getElementById('password').value==""){
				alert("请输入密码。");
				return false;
			}else{
				return true;
			}
		}
		
		</script> 
    
</head>
<body>
  <div class="container_12">
    <div id="top">
      <div class="grid_3">
        <div class="phone_top">
          Call CN +110
        </div><!-- .phone_top -->
      </div><!-- .grid_3 -->

      <div class="grid_6">
        <div class="welcome">
 当前在线人数:<%=OnlineCounter.getOnline()%>
        </div><!-- .welcome -->
      </div><!-- .grid_6 -->

      <div class="grid_3">
        
      </div><!-- .grid_3 -->
    </div><!-- #top -->

    <div class="clear"></div>

    <header id="branding">
      <div class="grid_3">
        <hgroup>
          <h1 id="site_logo" ><a href="index.jsp" title=""><img height="119.8" width="130.8" src="images/login.jpg" alt="Online Store Theme Logo"/></a></h1>
          <h2 id="site_description">年轻人的第一个游戏网</h2>
        </hgroup>
      </div><!-- .grid_3 -->

      <div class="grid_3">
        <form class="search" action="catalog_search.jsp" method="post">
          <input type="text" name="search" class="entry_form" value="" placeholder="寻找游戏"/>&nbsp;
	</form>
      </div><!-- .grid_3 -->

      <div class="grid_6">
        <ul id="cart_nav">
          <li>
            <a class="cart_li" href="shop_cart.jsp"><span>购物车</span></a>
              </li>
            </ul>


        <nav class="private">
          <ul>
       <% if(session.getAttribute("userSession")==null){%> 
            <li><a href="login.jsp">登录</a></li>
            <li class="separator">|</li>
            <li><a href="Create user.jsp">注册</a></li>
        <%}else{  %>
       <li><a href="##.jsp">用户(<%=session.getAttribute("username") %>)身份(<%=session.getAttribute("userSession")%>)</a>
        <li class="separator">|</li>
       <% if(session.getAttribute("userSession").equals("管理员") ){ %><li><a href="admin/ht.jsp"><span>后台</span></a></li><% } %>
       <% if(session.getAttribute("userSession").equals("客户") ){ %><li><a href="Personal.jsp"><span>个人信息</span></a></li><% } %>
       <li class="separator">|</li>
       <li> <a href="deal/logout.jsp" >[注销]</a></li>
			    <%}  %>
          </ul>
        </nav><!-- .private -->
      </div><!-- .grid_6 -->
    </header><!-- #branding -->
  </div><!-- .container_12 -->
  
  <div class="clear"></div>
  
  <div id="block_nav_primary">
    <div class="container_12">
      <div class="grid_12">
        <nav class="primary">
          <ul>
                       <li class="curent"><a href="index.jsp">首页</a></li>
                                   <li><a href="blog_post.jsp">新闻</a></li>
                       <li><a href="catalog_grid.jsp">类型</a></li>
<%
	if (pl2.size() > 0) {
		for (int i = 0; i < pl2.size(); i++) {
			main_type pd2 = (main_type) pl2.get(i);			
%>
                <li><span><a href="catalog_grid.jsp?type=<%=pd2.getT_id()%>"><%=pd2.getT_type() %></a></span></li>
				<%}
				}else{ %>
                <li><span><a href="#">没有产品区</a></span></li>
				<%} %>
              </ul>
            </li>
          </ul>
        </nav><!-- .primary -->
      </div><!-- .grid_12 -->
    </div><!-- .container_12 -->
  </div><!-- .block_nav_primary -->
  
  <div class="clear"></div>
  
  <section id="main" class="entire_width">
    <div class="container_12">      
       <div id="content">
		<div class="grid_12">
			<h1 class="page_title">登录用户</h1>
		</div><!-- .grid_12 -->
		
		<div class="grid_6 new_customers">
                </div><!-- .grid_6 -->
		<div class="grid_6">
			<form class="registed" action="deal/do_login.jsp" method="POST" onSubmit="return fun_check_form()">
				<h2>登录</h2>
							
				<p>如果你没有账号，请<a href="Create user.jsp">注册</a></p>
							
				<div class="email">
					<strong>账号:</strong><sup class="surely">*</sup><br/>
					<input type="text" name="userName" id="userName" class=""  onkeyup="value=value.replace(/[\W]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
				</div><!-- .email -->
				
							<td width="300" align="left" bgcolor="#EBEBEB">
			<strong>身份类型<select name="Competence"  id="select" class="altbg2">
   <option  value="customer">顾客</option>
   <option  value="admin">管理员</option>
 </select> </strong>
       </td>
				<div class="password">
					<strong>密码:</strong><sup class="surely">*</sup><br/>
					<input type="text" name="password" id="password" class=""  onkeyup="value=value.replace(/[\W]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
					<!-- <a class="forgot" href="#">忘记密码?</a> -->
				</div><!-- .password -->
				
				<div class="submit">										
					<input type="submit"  value="登录" />
				</div><!-- .submit -->
			</form><!-- .registed -->
                </div><!-- .grid_6 -->
       </div><!-- #content -->
       
      <div class="clear"></div>
    </div><!-- .container_12 -->
  </section><!-- #main -->
  
  <div class="clear"></div>
    
  <footer>
  <div class="f_info">
      <div class="container_12">
        <div class="grid_6">
          <p class="copyright">BY 417工作室, 2015</p>
        </div><!-- .grid_6 -->

        <div class="grid_6">
          <div class="soc">
 
          </div><!-- .soc -->
        </div><!-- .grid_6 -->

        <div class="clear"></div>
      </div><!-- .container_12 -->
    </div><!-- .f_info -->
  </footer>
 
</body>
</html>